# _*_ coding: UTF-8 _*_
# @Time     : 2021/11/3 18:43
# @Author   : Gong Yangyi
# @Site     : http://www.hzdledu.cn/
# @File     : web_智慧云.py
# @Software : PyCharm
from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.wait import WebDriverWait  # 等待类
from selenium.webdriver.support import expected_conditions  # 等待条件
from selenium.webdriver.common.by import By  # 定位符


def case001():
    driver = webdriver.Chrome()
    driver.get('http://192.168.6.189/cloud/#/open/login')
    driver.maximize_window()
    driver.find_element_by_xpath('//*[@id="account"]/input').send_keys('admin')
    driver.find_element_by_xpath('//*[@id="password"]/input').send_keys('123456')
    driver.find_element_by_xpath('//*[@id="authCode"]/div/input').send_keys('8888')
    driver.find_element_by_xpath('//*[@id="root"]/div/div[1]/form/div[5]/div/div/span/button').click()# 点击登录按键
    time.sleep(1)
    ActionChains(driver).click(driver.find_element_by_xpath('//*[@id="root"]/section/aside/div/ul/li[4]/div[1]/span')).perform()#点击系统管理
    time.sleep(1)
    ActionChains(driver).click(driver.find_element_by_xpath('//*[@id="sys$Menu"]/li[1]/a')).perform()#点击城市列表
    time.sleep(1)
    ActionChains(driver).click(driver.find_element_by_xpath('//*[@id="root"]/section/section/main/div/div[1]/button[1]')).perform()#点击添加按键
    time.sleep(1)
    driver.find_element_by_xpath('//*[@id="city"]').send_keys('成都')
    time.sleep(1)
    driver.find_element_by_xpath('/html/body/div[2]/div/div[2]/div/div[2]/div[3]/button').click()
    time.sleep(1)

    driver.quit()
if __name__== '__main__':
    case001()
